package com.v2future.sjt.collegecheckingattendance.rollcall.bean;

import com.v2future.sjt.collegecheckingattendance.utils.BaseResponseBean;

import java.io.Serializable;
import java.util.Comparator;
import java.util.List;

/**
 * 点名的课程实体
 * Created by Administrator on 2016/10/12.
 */

public class CourseBean extends BaseResponseBean implements Serializable{

    /**
     * courseId : 3
     * courseName : 法学专业导论
     * courseNumber : 2
     * weekDay : 1
     */

    private List<DataBean> data;

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean implements Serializable,  Cloneable{
        private String teacherId;//老师的id 个人添加
        private String courseId;
        private String courseName;
        private String courseNumber;
        private String weekDay;

        public String getTeacherId() {
            return teacherId;
        }

        public void setTeacherId(String teacherId) {
            this.teacherId = teacherId;
        }

        public String getCourseId() {
            return courseId;
        }

        public void setCourseId(String courseId) {
            this.courseId = courseId;
        }

        public String getCourseName() {
            return courseName;
        }

        public void setCourseName(String courseName) {
            this.courseName = courseName;
        }

        public String getCourseNumber() {
            return courseNumber;
        }

        public void setCourseNumber(String courseNumber) {
            this.courseNumber = courseNumber;
        }

        public String getWeekDay() {
            return weekDay;
        }

        public void setWeekDay(String weekDay) {
            this.weekDay = weekDay;
        }

        /**
         * 获取课程时间
         * @return 时间字符串
         */
        public String getTime(){
            int courseNumber = 0;
            int weekNumber = 0;
            try {
                courseNumber = Integer.parseInt(this.courseNumber);
                weekNumber = Integer.parseInt(weekDay);
            }catch (Exception e){
                e.printStackTrace();
            }
            if (courseNumber == 0 || weekNumber == 0) return null;
            String weekWord = "";
            switch (weekNumber) {
                case 2:
                    weekWord = "二";
                    break;
                case 3:
                    weekWord = "三";
                    break;
                case 4:
                    weekWord = "四";
                    break;
                case 5:
                    weekWord = "五";
                    break;
                case 6:
                    weekWord = "六";
                    break;
                case 7:
                    weekWord = "日";
                    break;
                case 1:
                    weekWord = "一";
                    break;
            }
            if (courseNumber >= 1 && courseNumber <= 4) {
                return "周"+weekWord+"上午";
            }
            else if (courseNumber >= 5 && courseNumber <= 8) {
                return "周"+weekWord+"下午";
            }
            else if (courseNumber >= 9 && courseNumber <= 11) {
                return "周"+weekWord+"晚上";
            }
            return null;
        }

        public DataBean clone(){
            DataBean o = null;
            try{
                o = (DataBean)super.clone();
            }catch(CloneNotSupportedException e){
                e.printStackTrace();
            }
            return o;
        }
    }
}
